<template>
  <el-dialog
    title="请选择用户"
    :visible.sync="visible"
    :close-on-click-modal="false"
    top="8vh"
    ref="table"
  >
    <el-table
      :height="tableHeight"
      class="mt-2 el-ov-single-checkbox-table"
      stripe
      v-loading="loading"
      :data="rows"
      size="small"
      ref="table"
    >
      <el-table-column type="selection" label="" width="55"> </el-table-column>
      <el-table-column type="index" label="序号" width="55"> </el-table-column>

      <el-table-column prop="displayName" label="昵称"> </el-table-column>
      <el-table-column prop="name" label="用户名"> </el-table-column>
      <!-- <el-table-column prop="mobile" label="手机号"> </el-table-column> -->
      <el-table-column prop="uid" label="用户ID"> </el-table-column>
      <el-table-column prop="portrait" label="头像">
        <template slot-scope="{ row }">
          <img :src="row.portrait" class="w-8 h-8 rounded-full" />
        </template>
      </el-table-column>
      <el-table-column prop="createTime" label="创建时间">
        <template slot-scope="{ row }">
          {{ row.createTime | time2str }}
        </template>
      </el-table-column>
    </el-table>
    <the-page ref="page" @change="fetch" />

    <div slot="footer" class="-mt-6">
      <el-button class="px-12" size="small" type="primary" @click="onSubmit"
        >确定</el-button
      >
    </div>
  </el-dialog>
</template>

<script>
import rowsCurl from "@/mixins/rows-curl";
import thePage from "@/components/page.vue";
export default {
  components: { thePage },
  mixins: [rowsCurl],
  data() {
    return {
      visible: false,
      uri: {
        list: "user/list",
      },
      owner: null,
    };
  },
  methods: {
    open() {
      this.visible = true;
    },
    onSubmit() {
      this.$emit("set-owner", this.$refs.table.selection);
      this.visible = false;
      // console.log(row);
    },
  },
};
</script>

<style lang="scss">
</style>